<?php
require_once 'BaseController.php';
require_once APPLICATION_PATH."modules/admin/models/Admin_Model_Account.php";
class Admin_IndexController extends Admin_BaseController
{
    public function init()
    {

    }

    public function indexAction()
    {
        $this->render("login");
    }

    //登录检查
    public function loginAction()
    {
        $a_name = $this->getRequest()->getParam("a_name");
        $a_pwd = $this->getRequest()->getParam("a_pwd");
        $this->loginCheck($a_name,$a_pwd);

    }

    //登录检查

    public function loginCheck($a_name,$a_pwd)
    {
        if(!empty($a_name) && !empty($a_pwd)){
            $accountModel = new Admin_Model_Account();
            $db = $accountModel->getAdapter();
            $where = $db->quoteInto("a_name=?", $a_name) . $db->quoteInto(" AND a_pwd = ?", md5($a_pwd));

            echo "<pre>";
            echo "aaa";
            print_r($accountModel->fetchRow($where));
            exit();
        }else{
            $this->view->msg = "用户名或者密码不能为空！";
            $this->_forward("message","global");
            return;
        }


    }
}

